<template>
	<view class="commentItem">
		<view class="outer">
			<view class="avatar">
				<image class="pic" src="../../static/images/defAvatar.png"></image>
			</view>

			<view class="content">
				<view class="userinfo">

					<view class="left">
						<view class="name">咸虾米</view>
						<view class="time">一个月前</view>
					</view>

					<view class="right">
						<view class="like">
							<view class="number">33</view>
							<uni-icons v-if="true" type="hand-up" size="20" color="#a7a7a7"></uni-icons>
							<uni-icons v-else type="hand-up-filled" size="20" color="#dd524d"></uni-icons>
						</view>
						<view class="remove">
							<uni-icons type="trash" size="20" color="#a7a7a7"></uni-icons>
							<text class="text">删除</text>
						</view>
					</view>
				</view>

				<view class="replay" @click="goReply">
					<text class="text" v-if="false">
						回复<text class="nickname">@李四：</text>
					</text>
					这是评论内容
				</view>

			</view>



		</view>

		<view class="subReplay" v-if="subReply" @click="goReply">
			<view class="list">
				<view class="row">
					张三：11111
				</view>
				<view class="row">
					李四：22222
				</view>
				<view class="row more">
					共3条回复
					<uni-icons type="right" size="16" color="#a7a7a7"></uni-icons>
				</view>
			</view>
		</view>

	</view>
</template>

<script setup>
	const props = defineProps({
		subReply: {
			type: Boolean,
			default: false
		}
	})


	// 点击回复
	const goReply = () => {
		// 只有当传入的为true，才允许跳转到详情页面
		if (props.subReply) {
			uni.navigateTo({
				url: "/pages/detail/reply"
			})
		}
	}
</script>

<style scoped lang="scss">
	.commentItem {
		padding: 30rpx;

		.outer {
			display: flex;
			justify-content: space-between;
			//	align-items: flex-start;

			.avatar {
				width: 60rpx;
				height: 60rpx;
				margin-right: 30rpx;
				border-radius: 50%;
				overflow: hidden;

				.pic {
					width: 100%; // 继承父类宽高
					height: 100%;
				}
			}

			.content {
				flex: 1;

				.userinfo {
					height: 60rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.left {
						.name {
							font-size: 26rpx;
							color: $text-font-color-2;
						}

						.time {
							font-size: 22rpx;
							color: $text-font-color-3;
						}
					}

					.right {
						display: flex;
						color: $text-font-color-3;
						font-size: 22rpx;
						align-items: center;

						.like {
							display: flex;
							align-items: center;

							.number {
								margin-right: 5rpx;
							}

						}

						.remove {
							margin-left: 20rpx;
							display: flex;
							align-items: center;
							justify-content: center;

							.text {
								margin-left: 5rpx;
							}
						}
					}
				}

				.replay {
					padding: 20rpx 0;
					font-size: 30rpx;
					color: $text-font-color-1;
					line-height: 1.7em;

					.text {
						color: $text-font-color-3;

						.nickname {
							color: $brand-theme-color;
						}
					}
				}
			}

		}


		.subReplay {
			padding-left: 80rpx;

			.list {
				background: #f4f4f4;
				padding: 20rpx;
				border-radius: 10rpx;

				.row {
					line-height: 1.8em;
					font-size: 28rpx;
					color: $text-font-color-2;
				}

				.more {
					color: $text-font-color-3;
				}
			}
		}

	}
</style>